AssignGridIntegerReal Subroutine

private subroutine AssignGridIntegerReal(mat, mask)

assign value of mask integer to mat real

Arguments

Type IntentOptional Attributes Name
type(grid_real), intent(inout) :: mat
type(grid_integer), intent(in) :: mask

Variables

Type Visibility Attributes Name Initial
integer, public :: i
integer, public :: j

Source Code

SUBROUTINE AssignGridIntegerReal &
!
(mat, mask)

IMPLICIT NONE

!Arguments with intent(in):
TYPE(grid_integer),INTENT(IN) :: mask

!Arguments with intent (inout)
TYPE(grid_real),INTENT(INOUT):: mat

!Local declarations:
INTEGER :: i,j

!---------------------------end of declarations--------------------------------

!check spatial reference
!IF ( .NOT. CRSisEqual (mask, mat, .TRUE.) ) THEN
IF ( .NOT. CRSisEqual (mask, mat) ) THEN
  CALL Catch ('error', 'GridOperations',  &
    'while assigning grid content from another grid: ',  &
     argument = 'spatial reference not equal' ) 
END IF

DO i = 1, mat % idim
  DO j = 1, mat % jdim
    IF (mat % mat (i,j) /= mat % nodata) THEN !cast to real number
      mat % mat(i,j) = REAL ( mask % mat(i,j) )
    ELSE !fix nodata
       mat % mat(i,j) = -9999.9
    END IF
  END DO
END DO

mat % nodata = -9999.9

END SUBROUTINE AssignGridIntegerReal